package com.gzy.xuexiziliao.mapper;

import com.gzy.xuexiziliao.pojo.entity.Admin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface AdminMapper {

    @Select("select * from admin where username = #{username} and password = #{password}")
    Admin login(Admin admin);

    @Insert("insert into admin(username,password,name,gender,create_time,update_time) " +
            "values (#{username},#{password},#{name},#{gender},#{createTime},#{updateTime})")
    void save(Admin admin);

    @Select("select * from admin where id = #{id}")
    Admin getById(Integer id);

    void update(Admin admin);

    List<Admin> list(String name, Short gender, LocalDate begin, LocalDate end);

    void delete(List<Integer> ids);

    List<Admin> getByName(String name);
}